A hybrid graphical model of a dynamic system may include one or more of graphical blocks from at least two different domains. For example, a hybrid Discrete Event System model may include time-driven components that may be modeled using a time domain modeling and simulation environment, e.g. Simulink®, and event-driven components that may be modeled using an event domain modeling and simulation environment, e.g. SimEvents®. Existing techniques provide a single event calendar for simulation of a hybrid Discrete Event System model, where all events scheduled by the model enter a common calendar for execution. The single event calendar processes the events scheduled by all event-driven components of the model before allowing other components, e.g. time-driven components, to execute. However, many models require the execution of some time-driven components in between the execution of event-driven components. Existing techniques do not support interleaved execution of multi-domain components of a hybrid Discrete Event System model.
In a prior art system, SimEvents® Version 3.0 from the MathWorks, Inc. that works with the time-driven block diagrams of Simulink®, there are blocks that execute in either the discrete event domain or the time domain. The execution paradigm of this framework consisted of collecting up all discrete event blocks and placing them at the end of a block sorted list. The execution engine would then run the block methods following the block sorted list order whereby the time-driven blocks would execute before all the discrete event blocks. This paradigm for modeling and simulation introduced data delays and other data consistency problems at the interaction of the two domains as defined by the signal lines. An additional problem that occurs with grouping all the discrete event blocks at the end of the sorted list is that only one event calendar is used. A single event calendar makes it impossible to correctly interleave the execution of time-driven blocks with discrete event based blocks, further causing inconsistencies in the simulation. In the prior art systems, because all blocks were grouped together, there was no need to demarcate the discrete event block from the time-based blocks, which hurts the readability of the block diagram. In the present application, the problems with the prior art system have been addressed by providing multiple subgraphs, demarcation of the subgraphs using gateways, and separate event calendars for each discrete event subgraph in the graphical model.